<template>
  <div class="BoxAll">
    <div class="loginBox">
      <div class="TitleName">
        <div>登</div>
        <div>录</div>
      </div>
      <div class="userName">
        <div class="userTit">账户：</div>
        <div class="userTab">
          <el-input v-model="countInput" size="large" style="width: 380px" placeholder="请输入账户" />
        </div>
      </div>
      <div class="userName">
        <div class="userTit">密码：</div>
        <div class="userTab">
          <el-input v-model="messageInput" size="large" style="width: 380px" placeholder="请输入密码" />
        </div>
      </div>
      <div class="loginButton">
        <div class="lbt" @click="loginWebSitMession">登录</div>
        <div class="returnButton">忘记密码?</div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref } from "vue";
import { ElMessage } from "element-plus";
import { useRouter } from "vue-router";
let countInput = ref("");
let messageInput = ref("");
//模拟用户登录
let userName1 = ref("user1001");
let userPassword1 = ref("123456");
let router = useRouter();
function loginWebSitMession() {
  if (
    countInput.value != userName1.value &&
    messageInput.value != userPassword1.value
  ) {
    ElMessage.error("登录失败，请重试");
  } else if (
    countInput.value == userName1.value &&
    messageInput.value != userPassword1.value
  ) {
    ElMessage({
      message: "密码输入有误，请重试",
      type: "warning",
    });
  } else if (
    countInput.value == userName1.value &&
    messageInput.value == userPassword1.value
  ) {
    ElMessage({
      message: "正在登录，请稍后",
      type: "success",
    });
    setTimeout(() => {
      router.push('/Shop')
    }, 1000);
  }else{
    ElMessage.error("账号有误，请联系管理员");
  }
}
</script>

<style>
* {
  margin: 0;
  padding: 0;
  list-style: none;
  box-sizing: border-box;
}
input {
  background: none;
  border: none;
  line-height: 60px;
  font-size: 20px;
  color: rgb(234, 47, 106);
}
.el-input__inner{
  color: #ee4866 !important;
  font-size: 20px !important;
}
.el-input__wrapper{
  background-color: unset !important;
  border: unset !important;
  box-shadow: unset !important;
}
.BoxAll {
  width: 100vw;
  height: 100vh;
  position: relative;
  background: url("../utils/images/lake-And-Boot.jpeg") no-repeat -380px -100px /
    2540px;
}
.loginBox {
  width: 600px;
  height: 480px;
  text-align: center;
  border: 1px solid black;
  position: absolute;
  top: 0px;
  right: 180px;
  bottom: 0px;
  left: 0px;
  margin: auto;
  background: url("../utils/images/lake-And-Boot.jpeg") no-repeat -300px 0px / 1140px;
  opacity: 0.9;
}
.TitleName {
  height: 60px;
  width: 100px;
  margin: 30px auto;
  line-height: 60px;
  text-align: center;
  font-size: 30px;
  color: rgba(40, 40, 40);
  display: flex;
  justify-content: space-evenly;
  align-content: center;
}
.userName {
  width: 500px;
  height: 60px;
  border: 1px solid black;
  margin: 30px auto;
  display: flex;
  font-size: 20px;
  border-radius: 10px;
}
.userTit {
  width: 100px;
  line-height: 60px;
  text-align: center;
  font-weight: 800;
  color: black;
}
.userTab {
  text-align: center;
  line-height: 60px;
}
.loginButton {
  height: 60px;
  line-height: 60px;
  display: flex;
  justify-content: space-evenly;
  align-items: center;
}
.lbt {
  width: 150px;
  height: 40px;
  line-height: 40px;
  border-radius: 5px;
  background-color: #ee4866;
  color: aliceblue;
}
.lbt:hover {
  cursor: pointer;
  width: 200px;
  height: 50px;
  line-height: 50px;
  font-size: 30px;
}
.returnButton {
  width: 150px;
  height: 40px;
  line-height: 40px;
  border-radius: 5px;
  background-color: #74759b;
  color: aliceblue;
}
.returnButton:hover {
  cursor: pointer;
  width: 200px;
  height: 50px;
  line-height: 50px;
  font-size: 30px;
}
</style>